package com.logger.handlers;

import java.util.HashMap;
import java.util.Map;

/**
 * handler管理
 * Created by chenxunlin01 on 2016/1/16.
 */

public class HandlerManager {

    private static Map<String, AHandler> handlers;

    static {
        handlers = new HashMap<>();
    }

    public static boolean registerHandler(AHandler handler) {
        if (handler == null) {
            return false;
        }
        handlers.put(handler.getName(), handler);
        return true;
    }

    public static AHandler getHandler(String name) {
        return handlers.get(name);
    }
}
